<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件</title>
</head>

<body>

    <span id="aa"></span>
    <br>

    <button id="an">按钮</button>

</body>


<script>
    var span = document.getElementById('aa');
    var an = document.getElementById('an');
    an.onclick = function() {

        var data = new Date();
        span.innerText = data.getFullYear() + '年' + data.getMonth() + '月' + data.getDate() + '号' + '\t' + data.getHours() + ':' + data.getMinutes() + ':' + data.getSeconds();

    }
</script>



</html>